
#include "RepeteTest.h"

void RepeteTest::TestAnalyse(void ) {

	// Test de la classe Repete avec des Repete imbriqués
	Repete rep1;
	rep1.addCodeLobo("REPETE 10");
	rep1.addCodeLobo("DEBUT");
	rep1.addCodeLobo("REPETE 5");
	rep1.addCodeLobo("DEBUT");
	rep1.addCodeLobo("AFFICHE '*' ;");
	rep1.addCodeLobo("FIN_REPETE");
	rep1.addCodeLobo("FIN_REPETE");
	rep1.analyser();

	std::string result = "";
	result+="for (int loop0 = 1; loop0 <=10; ++loop0) { \n";
	result+="for (int loop1 = 1; loop1 <=5; ++loop1) { \n";
	result+="cout << \"*\" ;\n";
	result+="}\n";
	result+="}";

	CPPUNIT_ASSERT(rep1.toString() == result);
}

